import { _decorator, Component, Node, RigidBody2D, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('BaseMoveControl')
export class BaseMoveControl extends Component {

    @property({ type: Number, displayName: "移动速度", tooltip: "移动速度" })
    speed: number = 100;

    @property(RigidBody2D)
    rigidBody2D: RigidBody2D | null = null!;
    start() {
        this.rigidBody2D = this.getComponent(RigidBody2D);
        this.rigidBody2D?.applyLinearImpulseToCenter(new Vec2(-this.speed * 1, 0), true);

    }

    update(deltaTime: number) {
        //  this.node.position = new Vec3(this.node.position.x - this.speed * deltaTime, this.node.position.y, 0);
    }

}


